package concurrent.ch1;

public class JavaThreadAnyWhere {

    static class Helper implements Runnable {

        private final String message;

        public Helper(String message) {
            this.message = message;
        }

        private void doSomething(String message) {
            System.out.println("the doSomething method is executed by " +
                    Thread.currentThread().getName());

            System.out.println("doSomething with " + message);
        }

        @Override
        public void run() {
            doSomething(message);
        }
    }

    public static void main(String[] args) {
        System.out.println("the main method is executed by " + Thread.currentThread().getName());
        Helper helper = new Helper("anywhere");
        Thread t = new Thread(helper);
        t.start();
        helper.run();
    }

}
